package com.guoheng.safe.sys.controller;

import com.guoheng.safe.common.base.Result;
import com.guoheng.safe.sys.dto.IdDTO;
import com.guoheng.safe.sys.dto.basicinfo.ControlThresholdAddDTO;
import com.guoheng.safe.sys.dto.basicinfo.ControlThresholdPageDTO;
import com.guoheng.safe.sys.dto.basicinfo.ControlThresholdUpdateDTO;
import com.guoheng.safe.sys.service.ControlThresholdService;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 类功能描述:　BasicController
 *
 * @author Eternal
 * @date 2019-56-15 14:56
 */
@RestController
@Validated
@Api(value = "监控阈值数据表")
public class ControlThresholdController {

    @Resource
    ControlThresholdService controlThresholdService;

    @PostMapping(value = "basic/threshold/add")
    public Result addControlThreshold(@RequestBody @Valid ControlThresholdAddDTO controlThresholdAddDTO){
        return controlThresholdService.addControlThreshold(controlThresholdAddDTO);
    }

    @PostMapping(value = "basic/threshold/update")
    public Result updateControlThreshold(@RequestBody @Valid ControlThresholdUpdateDTO controlThresholdUpdateDTO){
        return controlThresholdService.updateControlThreshold(controlThresholdUpdateDTO);
    }

    @PostMapping(value = "basic/threshold/delete")
    public Result deleteControlThreshold(@RequestBody @Valid IdDTO idDTO){
        return controlThresholdService.deleteControlThreshold(idDTO);
    }

    @PostMapping(value = "basic/threshold/query")
    public Result getControlThreshold(@RequestBody @Valid IdDTO idDTO){
        return controlThresholdService.getControlThreshold(idDTO);
    }

    @PostMapping(value = "basic/threshold/page")
    public Result getControlThresholds(@RequestBody @Valid ControlThresholdPageDTO pageDTO){
        return controlThresholdService.getControlThresholdPage(pageDTO);
    }

}
